import java.sql.Array;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;

public class Test {
    public static  int[] smallestK(int[] arr, int k) {
        int[] ret = new int[k];
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2.compareTo(o1);
            }
        });

        for (int i = 0; i < k; i++) {
            priorityQueue.offer(arr[i]);
        }

        for (int  i = k; i < arr.length; i++) {
            if (arr[i] < priorityQueue.peek()) {
                priorityQueue.poll();
                priorityQueue.offer(arr[i]);
            }
        }

        for (int i = 0; i < k; i++) {
            ret[i] = priorityQueue.poll();
        }

        return ret;

    }


    public static void main(String[] args) {
        //int[] array = {27,15,19,18,28,34,65,49,25,37};
       // int[] ints = smallestK(array, 4);
       // System.out.println(Arrays.toString(ints));
        TestHeap heap = new TestHeap();
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        heap.initElem(array);
        heap.createHead();
        heap.heapSort();

        System.out.println();


    }
    public static void main1(String[] args) {
        TestHeap heap = new TestHeap();
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        heap.initElem(array);
        heap.createHead();

        heap.push(80);


    }
}
